const user = {
    state() {//通过$store.state.模块名.状态名获取数据
        return {
            userName: "用户张三"
        }
    },
    getters: {//通过$stroe.getters直接获取
        userNameAge: function (state,getters,rootState) {//state属于局部状态
            console.log(getters);
            console.log(rootState);//获取根节点实例的状态   actions也是相同
            return state.userName + '今年18岁了'
        }
    },
    mutations:{//通过$store.commit()即可,actions也是一样
        updateUsername:function(state){
            state.userName='用户李四'

        }
    },
}